/*
 * ParcelTest.java
 *
 * This program uses the Parcel class to demonstrate nested classes.
 *
 * 
 */

package com.javacore.day8.courier;

/**
 * This program demonstrates the use of Parcel class and
 * its nested classes Content and Destination.
 * @author 
 */
public class ParcelTest {
    
    /** Creates a new instance of ParcelTest */
    public ParcelTest() {
    }
    
    /**
     * This is the entry point of the application.
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        // Display the various commodities and the minimum parcel weight
        System.out.println("Welcome to ATC Courier Service.");
        System.out.println("We deliver the following commodities with a " +
                "minimum parcel weight as shown below.");
        System.out.format("%1$-20s %2$5s \n", "Commodity Type", "Minimum Weight(lbs)");
        System.out.format("%1$-20s %2$5d \n", "Food Items", 3);
        System.out.format("%1$-20s %2$5d \n", "Cosmetics", 4);
        System.out.format("%1$-20s %2$5d \n", "Books", 5);
        System.out.println("-------------------------------");
        
        // Create an instance of class Parcel
        Parcel objParcel = new Parcel();
        
        // Create an instance of nested class Content using Parcel instance
        Parcel.Content objContent = objParcel.new Content();
        
        // Create an instance of nested class Destination using Parcel instance
        Parcel.Destination objDestination = objParcel.new Destination();
        
        // Accept content and destionation details of the parcel
        objContent.setContentDetails();
        objDestination.setDestinationDetails();
        
        // Display the content and destination details of the parcel
        objContent.getContentDetails();
        objDestination.getDestinationDetails(objContent.rate, objContent.weight);
    }
}